package com.hm.jiaowuxitong.ui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class ShowStudentGui {
    private int frame_width=770;
    private int frame_height=460;
    public ShowStudentGui(){
        //创建添加学生信息的面板
        JFrame frame=new JFrame("添加班级信息");
        //设置面板的宽高
        frame.setSize(frame_width,frame_height);
        //禁止面板放大缩小
        frame.setResizable(false);
        //创建画布
        JPanel panel=new JPanel();
        //创建方向布局
        SpringLayout layout=new SpringLayout();
        panel.setLayout(layout);

        JButton button2=new JButton("查询单个学生");
        layout.putConstraint(SpringLayout.WEST,button2,150,SpringLayout.WEST,panel);
        layout.putConstraint(SpringLayout.NORTH,button2,250,SpringLayout.NORTH,panel);
        button2.setForeground(Color.black);
        button2.setFont(new Font(" ", 3, 15));
        JButton button3=new JButton("查询所有学生");
        layout.putConstraint(SpringLayout.WEST,button3,150,SpringLayout.EAST,panel);
        layout.putConstraint(SpringLayout.NORTH,button3,330,SpringLayout.NORTH,panel);
        button3.setForeground(Color.black);
        button3.setFont(new Font(" ", 3, 15));

        //创建提交按钮
        JButton button1=new JButton("返回");
        layout.putConstraint(SpringLayout.WEST,button1,150,SpringLayout.EAST,panel);
        layout.putConstraint(SpringLayout.NORTH,button1,400,SpringLayout.NORTH,panel);
        button1.setForeground(Color.black);
        button1.setFont(new Font(" ", 3, 15));

        // 创建标题标签
        JLabel label = new JLabel("风景一览");
        label.setForeground(new Color(7, 96, 186));
        Font font = new Font(label.getFont().getName(), Font.PLAIN, 30);
        label.setFont(font);
        layout.putConstraint(SpringLayout.NORTH,label,5,SpringLayout.NORTH,panel);
        layout.putConstraint(SpringLayout.EAST,label,-70,SpringLayout.EAST,panel);

        JLabel img1=new JLabel();
        ImageIcon imageIcon1 = new ImageIcon("image/img_5.png");  // 将"path/to/your/image.jpg"替换为你的图片路径
        img1.setIcon(imageIcon1);

        layout.putConstraint(SpringLayout.NORTH,img1,100,SpringLayout.NORTH,panel);
        layout.putConstraint(SpringLayout.EAST,img1,-20,SpringLayout.EAST,panel);
        label.setPreferredSize(new Dimension(200,80));
        panel.add(label);

        JLabel img=new JLabel();
        ImageIcon imageIcon = new ImageIcon("image/4.jpg");  // 将"path/to/your/image.jpg"替换为你的图片路径
        img.setIcon(imageIcon);

        panel.add(button1);
        panel.add(button2);
        panel.add(button3);

        button1.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new TeacherGui();
                frame.dispose();

            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button2.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new ShowSelfStudentButtom();
                frame.dispose();

            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button3.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new ShowStudentInfoList(2);

            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
    }

}
